<script setup lang="ts" name="LogininforDetail">
import { PropType } from "vue";

const { sys_common_status } = useDict("sys_common_status");

const emit = defineEmits(['closeDialog']);

const props = defineProps({
  row: {
    type: Object as PropType<LogininforRecord>,
    default: () => ({}),
  },
  title: {
    type: String,
    default: false,
  }
});
const open = ref(false);

const form = ref<LogininforRecord>({});

/** 获取登陆日志详情 */
function getData() {
  form.value = props.row;
  open.value = true;
}

/** 关闭弹窗 */
function closeDialog(refresh: boolean) {
  open.value = false;
  emit("closeDialog", refresh);
}

watch(open, (val) => {
  if (!val) {
    closeDialog(false);
  }
});

getData();
</script>

<template>
  <!-- 登陆日志详情对话框 -->
  <el-dialog :title="title" v-model="open" width="700px" append-to-body>
    <div class="detail-form">
      <el-form ref="logininforForm" :model="form" label-width="80px">
        <el-form-item label="访问编号" prop="infoId">
          {{ form.infoId }}
        </el-form-item>
        <el-form-item label="用户名称" prop="userName">
          {{ form.userName }}
        </el-form-item>
        <el-form-item label="地址" prop="ipaddr">
          {{ form.ipaddr }}
        </el-form-item>
        <el-form-item label="登录地点" prop="loginLocation">
          {{ form.loginLocation }}
        </el-form-item>
        <el-form-item label="操作系统" prop="os">
          {{ form.os }}
        </el-form-item>
        <el-form-item label="浏览器" prop="browser">
          {{ form.browser }}
        </el-form-item>
        <el-form-item label="登录状态" prop="status">
          <dict-tag :options="sys_common_status" :value="form.status" />
        </el-form-item>
        <el-form-item label="描述" prop="msg">
          {{ form.msg }}
        </el-form-item>
        <el-form-item label="访问时间" prop="loginTime">
          {{ form.loginTime }}
        </el-form-item>
      </el-form>
    </div>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="closeDialog(false)">取 消</el-button>
      </div>
    </template>
  </el-dialog>
</template>

<style lang="scss" scoped>

</style>